<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:h="http://xmlns.jcp.org/jsf/html" xmlns:ui="http://xmlns.jcp.org/jsf/facelets" xmlns:p="http://primefaces.org/ui"
	xmlns:c="http://java.sun.com/jsp/jstl/core">

<h:head>
	<!-- implement a header based on login status -->
</h:head>

<h:body>

	<div class="navbar navbar-default navbar-fixed-top" role="navigation">
		<div class="container">

			<!-- part of the header that is always visible -->
			<div class="navbar-header">
				<button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">
					<span class="sr-only">Toggle navigation</span> <span class="icon-bar"></span> <span class="icon-bar"></span> <span class="icon-bar"></span>
				</button>
				<a class="navbar-brand" href="index.xhtml">Pok&eacute;TradeShop</a>
			</div>

			<div class="navbar-collapse collapse">
				<ul class="nav navbar-nav">
					<li><a href="faq.xhtml">FAQ</a></li>
					<li><a href="masthead.xhtml">Impressum</a></li>
				</ul>
				<form class="navbar-form navbar-left" role="search">
					<h:form>
						<div class="form-group">
							<h:inputText type="text" class="form-control" placeholder="Suche" id="search" value="#{product.search}" />
						</div>
						<h:commandButton class="btn btn-default" value="Suche" action="#{productController.ProductBySearchBox}" />
					</h:form>
				</form>
				
				<!-- part of the header that is visible for guests -->
				<h:panelGroup rendered="#{customerSession.loggedIn == 0}" id="headerGuest">
					<ul class="nav navbar-nav navbar-right" style="padding-top: 8px">
						<form class="form-inline" role="form">
							Willkommen, Gast! &nbsp; <a class="btn btn-default" href="login.xhtml">Login</a> <a class="btn btn-default" href="registration.xhtml">Registrieren</a>
						</form>
					</ul>
				</h:panelGroup>

				<!-- part of the header that is visible for used -->
				<h:panelGroup rendered="#{customerSession.loggedIn == 1}" id="headerUser">
					<ul class="nav navbar-nav navbar-right" style="padding-top: 8px">
						<form class="form-inline" role="form">
							Willkommen, #{customerSession.customerName}! &nbsp; 
							<a class="btn btn-default" href="profil.xhtml">Mein Profil</a> 
							<a class="btn btn-default" href="login.xhtml">Logout</a>
						</form>
					</ul>
				</h:panelGroup>
			</div>

		</div>
	</div>

</h:body>
</html>
